<script setup lang="ts">
import { ref } from 'vue'
import { Calendar, Location, User } from '@element-plus/icons-vue'

interface Activity {
  id: number
  name: string
  date: string
  time: string
  location: string
  participants: string
  description: string
}

const activities = ref<Activity[]>([
  {
    id: 1,
    name: '太极晨练',
    date: '2024-03-20',
    time: '08:00',
    location: '活动室',
    participants: '3/20 参与者',
    description: '由专业教练带领的太极拳姿势练习'
  },
  {
    id: 2,
    name: '园艺疗法',
    date: '2024-03-20',
    time: '10:00',
    location: '花园',
    participants: '4/15 参与者',
    description: '种植花草，培养兴趣'
  },
  {
    id: 3,
    name: '音乐欣赏会',
    date: '2024-03-21',
    time: '14:00',
    location: '多功能厅',
    participants: '3/30 参与者',
    description: '古典音乐欣赏与交流'
  }
])
</script>

<template>
  <div class="activities">
    <div class="page-header">
      <div class="header-content">
        <h1>活动安排</h1>
        <p class="subtitle">丰富多彩的文娱活动</p>
      </div>
      <el-button type="primary" class="add-button">
        <el-icon><Plus /></el-icon>
        添加活动
      </el-button>
    </div>

    <el-row :gutter="24">
      <el-col :span="8" v-for="activity in activities" :key="activity.id">
        <el-card class="activity-card" shadow="hover">
          <div class="activity-header">
            <h3>{{ activity.name }}</h3>
          </div>

          <div class="activity-content">
            <div class="info-item">
              <el-icon><Calendar /></el-icon>
              <div class="info-text">
                <span class="date">{{ activity.date }}</span>
                <span class="time">{{ activity.time }}</span>
              </div>
            </div>

            <div class="info-item">
              <el-icon><Location /></el-icon>
              <span>{{ activity.location }}</span>
            </div>

            <div class="info-item">
              <el-icon><User /></el-icon>
              <span>{{ activity.participants }}</span>
            </div>

            <div class="description">
              {{ activity.description }}
            </div>
          </div>

          <div class="activity-actions">
            <el-button 
              class="action-button edit-button"
              text
            >
              编辑活动
            </el-button>
            <el-button 
              class="action-button primary-button"
              type="primary"
            >
              报名参加
            </el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<style scoped lang="scss">
.activities {
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;

    .header-content {
      h1 {
        font-size: 28px;
        font-weight: 600;
        margin: 0 0 8px;
        color: var(--primary-text);
      }

      .subtitle {
        font-size: 16px;
        color: var(--secondary-text);
        margin: 0;
      }
    }

    .add-button {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px 24px;
      font-size: 16px;
    }
  }

  .activity-card {
    margin-bottom: 24px;
    background-color: var(--primary-bg);
    border: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;

    &:hover {
      transform: translateY(-4px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    }

    .activity-header {
      margin-bottom: 24px;

      h3 {
        font-size: 20px;
        font-weight: 600;
        margin: 0;
        color: var(--primary-text);
      }
    }

    .activity-content {
      .info-item {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
        color: var(--secondary-text);

        .el-icon {
          font-size: 16px;
          color: var(--accent-color);
        }

        .info-text {
          display: flex;
          gap: 12px;
          font-size: 14px;
        }
      }

      .description {
        margin-top: 20px;
        color: var(--secondary-text);
        font-size: 14px;
        line-height: 1.6;
      }
    }

    .activity-actions {
      display: flex;
      justify-content: flex-end;
      gap: 12px;
      margin-top: 24px;
      padding-top: 24px;
      border-top: 1px solid var(--secondary-bg);

      .action-button {
        min-width: 100px;
        height: 36px;
        font-size: 14px;
        font-weight: 500;
        border-radius: 18px;
        padding: 0 20px;
        
        &.edit-button {
          color: var(--secondary-text);
          
          &:hover {
            color: var(--primary-text);
          }
        }
        
        &.primary-button {
          background: var(--accent-color);
          border-color: var(--accent-color);
          
          &:hover {
            opacity: 0.9;
          }
        }
      }
    }
  }
}
</style>